function component(path) {
  return () => import(`src/views/${path}`)
}

import Layout from '@/layout'

const routes = [
  {
    path: '/login',
    component: component('login'),
    name: 'login'
  },
  {
    path: '/',
    redirect: 'demo',
    component: Layout,
    children: [
      {
        path: 'demo',
        component: component('demo'),
        name: 'demo',
        meta: { title: 'demo页面' },
        children: [
          {
            path: 'demo1',
            component: component('demo'),
            name: 'demo1',
            meta: { title: 'demo页面1' }
          },
        ]
      },
    ]
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: 'underDev',
        component: component('underDev'),
        name: 'underDev'
      },
    ]
  },
  {
    path: '/404',
    component: component('404'),
    name: 'page404'
  },
  {
    path: '*',
    redirect: '/404'
  }
]

export default routes
